package com.ylr.base.common.jsr303.annotation;



import com.ylr.base.common.jsr303.validator.ListIntegerValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;

/**
 * Created by IntelliJ IDEA.
 *
 * @author wei
 * date: 2023-04-05 16:45:37
 * className: ListInteger 整数列表枚举值校验注解
 * version: 1.0
 * description:
 */
@Documented
@Constraint(
    validatedBy = { ListIntegerValidator.class }
)
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.PARAMETER, ElementType.TYPE_USE})
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(ListInteger.List.class)
public @interface ListInteger {

    /**
     * 枚举值列表
     * 已排序的数组
     */
    int[] enumValues() default {};

    /**
     * 提示消息
     */
    String message() default "枚举值错误";

    /**
     * 分组
     */
    Class<?>[] groups() default {};

    /**
     *
     */
    Class<? extends Payload>[] payload() default {};

    @Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.PARAMETER, ElementType.TYPE_USE})
    @Retention(RetentionPolicy.RUNTIME)
    @Documented
    @interface List {
        ListInteger[] value();
    }

}
